import storage from '@blueos.storage.storage'

const key = 'deviceId'

export const getDeviceId = () => {
  let value = storage.getSync({ key: key })
  if (!value) {
    value = String(Date.now())
    storage.set({
      key,
      value: value,
      success: function (data) {
      },
      fail: function (data, code) {
        console.log(`handling fail, code = ${code}`)
      },
    })
  }
  return value
}